export default class video {
  constructor(path,poster = "untitled") {
    this.ctx = wx.createVideo()
    this.ctx.src = path
    this.ctx.poster = poster
    this.state = "init" // loaded playing paused stoped waiting destroyed
    this.info = {}
  }
  getDuration() {
    return this.ctx.duration
  }
  getCurrentTime() {
    return this.ctx.currentTime
  }
  getBuffered() {
    return this.ctx.buffered
  }
  setVolume(n) {
    this.ctx.volume = n
  }
  setCallback(event, callback) {
    this.ctx[event](callback)
  }
  play() {
    this.ctx.play()
  }
  seek(pos) {
    this.ctx.pause(pos)
  }
  stop() {
    this.ctx.stop()
  }
  pause() {
    this.ctx.stop()
  }
  destroy() {
    this.ctx.destroy()
  }
  fullScreen(){
    this.ctx.requestFullScreen()
  }
}